#ifndef ONED2TWOD_H
#define ONED2TWOD_H

#include <QObject>
#include <QHash>
#include <QPoint>
#include <QList>

template<class V>
class OneD2TwoD : public QObject
{
public:
    OneD2TwoD();

    void set(unsigned int nRow,unsigned int nCol,V val);
    void set(unsigned int nIndex,V val);
    V get(unsigned int nRow,unsigned int nCol);
    V get(unsigned int nIndex);
    QList<V> find(QPoint pos);
    void clear();
    unsigned int count();

    void setRows(unsigned int nRows);
    unsigned int rows();
    void setCols(unsigned int nCols);
    unsigned int cols();
    void setCapacity(unsigned int nTotal);
    unsigned int capacity();

    V left(V current);
    V top(V current);
    V right(V current);
    V bottom(V current);

private:
    unsigned int mnRows,mnColumns;
    QHash<unsigned int,V> mStore;
    unsigned int mnCapacity;
};

#endif // ONED2TWOD_H
